package com.ruoyi.dto;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.flowable.FlowComment;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>工作流任务<p>
 *
 * @author XuanXuan
 *
 */
@Getter
@Setter

public class FlowTaskDTO implements Serializable {
    private String currTaskKey;

    
    private String taskId;

    private boolean isFirstNode;

    //是否会签
    private boolean isMultipleInstances;

    private DetailPage page;

    
    private String executionId;

    
    private String variable;

    
    private String attrs;

    
    private String variableMap;

    
    private String canEdit;

    
    private String canAudit;

    
    private String businessName;

    
    private String businessKey;

    
    private String taskKey;

    
    private String taskName;

    
    private String taskDefKey;

    
    private Long assigneeId;

    
    private String deptName;

    
    private String startDeptName;

    
    private String assigneeName;

    
    private String startUserId;

    
    private String isStartUser;

    
    private String startUserName;

    
    private String category;

    
    private Object procVars;

    
    private Object taskLocalVars;

    
    private String deployId;

    
    private String procDefId;

    
    private String procDefKey;

    
    private String procDefName;

    
    private int procDefVersion;

    
    private String procInsId;

    
    private String hisProcInsId;

    
    private String duration;

    
    private FlowCommentDTO comment;

    
    private String candidate;


    
    private String flowStatus;

    
    private String flowStatusLabel;

    public String getFlowStatusLabel() {
        return FlowComment.codeToName(this.flowStatus);
    }

    public String getFlowStatusLabelType() {
        return FlowComment.codeToType(this.flowStatus);
    }

    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date finishTime;

    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    
    private String flowStatusLabelForList;

    public String getFlowStatusLabelForList() {
        return FlowComment.codeToNameForList(this.flowStatus);
    }

    public String getCanAudit() {
        if(endTime != null){
            return "false";
        }
        return "true";
    }

    public JSONObject getVariableMap() {
        return JSON.parseObject(variable);
    }
}
